# -*- coding: utf-8 -*-

# Define here the models for your scraped items
#
# See documentation in:
# https://doc.scrapy.org/en/latest/topics/items.html

import scrapy



class CarItem(scrapy.Item):
    detail_url = scrapy.Field() # 详情url
    title = scrapy.Field()  # 标题
    licensing_time = scrapy.Field()  # 上牌时间
    mileage = scrapy.Field()  # 表显里程
    displacement = scrapy.Field()  # 排量
    gearbox = scrapy.Field()  # 变速箱
    img_src = scrapy.Field() # 图片地址
    sale_price = scrapy.Field()  # 价格
    year_check = scrapy.Field()  # 年检到期
    insurance = scrapy.Field()  # 交强险
    store = scrapy.Field()  # 门店
    look_addr = scrapy.Field()  # 看车地点
    owner = scrapy.Field()  # 车主


# MapCompose 通过 传入 函数名 对数据进行预处理
from scrapy.loader.processors import MapCompose,TakeFirst

class CarItem_Crawl(scrapy.Item):
    url_finger_print = scrapy.Field() # 详情url加密字符串，用于 判重
    detail_url = scrapy.Field() # 详情url
    title = scrapy.Field(input_processor = MapCompose(str.strip))  # 标题
    licensing_time = scrapy.Field()  # 上牌时间
    mileage = scrapy.Field()  # 表显里程
    displacement = scrapy.Field()  # 排量
    gearbox = scrapy.Field()  # 变速箱
    img_src = scrapy.Field() # 图片地址
    sale_price = scrapy.Field(input_processor = MapCompose(str.strip))  # 价格
    year_check = scrapy.Field()  # 年检到期
    insurance = scrapy.Field()  # 交强险
    store = scrapy.Field()  # 门店
    look_addr = scrapy.Field()  # 看车地点
    owner = scrapy.Field()  # 车主

class CarImage(scrapy.Item):
    detail_id = scrapy.Field()     # 对应 二手车的 详情Id
    img_src = scrapy.Field()       # 要下载的 图片的 htttp 地址
    img_full_path = scrapy.Field() #原图下载的路径
    img_big_path = scrapy.Field()  # 大缩略图路径
    img_small_path = scrapy.Field() # 小缩略图路径
